package com.zbkj.service.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.zbkj.common.model.AiFittingRecord;
import com.zbkj.common.request.AiFittingRecordSearchRequest;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.service.dao.AiFittingRecordDao;
import com.zbkj.service.service.AiFittingRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author keNan
 * @description AiFittingRecordServiceImpl 接口实现
 * @date 2025-05-21
 */
@Service
public class AiFittingRecordServiceImpl extends ServiceImpl<AiFittingRecordDao, AiFittingRecord> implements AiFittingRecordService {

    @Resource
    private AiFittingRecordDao dao;


    /**
     * 列表
     *
     * @param request          请求参数
     * @param pageParamRequest 分页类参数
     * @return List<AiFittingRecord>
     * @author keNan
     * @since 2025-05-21
     */
    @Override
    public List<AiFittingRecord> getList(AiFittingRecordSearchRequest request, PageParamRequest pageParamRequest) {
        PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());

        //带 AiFittingRecord 类的多条件查询
//        LambdaQueryWrapper<AiFittingRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//        AiFittingRecord model = new AiFittingRecord();
//        BeanUtils.copyProperties(request, model);
//        lambdaQueryWrapper.setEntity(model);
//        if (StrUtil.isNotBlank(request.getStartTime())) {
//            lambdaQueryWrapper.ge(AiFittingRecord::getCreateTime, request.getStartTime());
//        }
//        if (StrUtil.isNotBlank(request.getStartTime())) {
//            lambdaQueryWrapper.ge(AiFittingRecord::getCreateTime, request.getStartTime());
//        }
//        if (StrUtil.isNotBlank(request.getEndTime())) {
//            lambdaQueryWrapper.le(AiFittingRecord::getCreateTime, request.getEndTime());
//        }
//        lambdaQueryWrapper.orderByDesc(AiFittingRecord::getId);
        List<AiFittingRecord> list = dao.selectByList(request);
        return list;
    }

}

